package com.qinyi.common.exception;

import com.qinyi.common.ajax.AjaxCode;
import org.apache.commons.lang3.StringUtils;

/**
 * @author wangan on 2019/5/31
 * @description
 */
public class CustomException extends RuntimeException {

	private AjaxCode ajaxCode;
	private String msg;

	public CustomException(AjaxCode ajaxCode, String message) {
		this.ajaxCode = ajaxCode;
		this.msg = message;
	}

	@Override
	public String getMessage() {
		if (StringUtils.isEmpty(this.msg)) {
			return this.getMessage();
		}
		return this.msg;
	}

	public AjaxCode getAjaxCode() {
		return ajaxCode;
	}

	public void setAjaxCode(AjaxCode ajaxCode) {
		this.ajaxCode = ajaxCode;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
}
